package com.android_map_app.activities;

import com.android_map_app.R;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class MainActivity extends ListActivity {
	
	public static final String USER_PREF = "PreferencesFile";
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        String[] items = getResources().getStringArray(R.array.main_items);
        setListAdapter(new ArrayAdapter<String>(this, R.layout.main_item, items));
        
        ListView listView = getListView();
        listView.setTextFilterEnabled(false);
        
        listView.setOnItemClickListener(new OnItemClickListener() {
            @Override
			public void onItemClick(AdapterView<?> parent, View view,
                int position, long id) {
            	switch (position) {
            		case 0:
            			startActivity(new Intent(getApplicationContext(), LoginActivity.class));
            			break;
            		case 1:
            			startActivity(new Intent(getApplicationContext(), RegisterActivity.class));
            			break;
            	}
            }
          });

    }
}